home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / monitory / sysmon / include / sysmon.h < prev    next >
C/C++ Source or Header  |  1995-11-19  |  6KB  |  170 lines

  1. /*
  2. **    $RCSfile: sysmon.h,v $
  3. **    $Filename: sysmon.h $
  4. **    $Revision: 0.6 $
  5. **    $Date: 1995/11/04 14:08:55 $
  6. **
  7. **    sysmon.library C header file (version 0.6) 
  8. **    
  9. **    (C) Copyright 1995 by Etienne Vogt
  10. */
  11.  
  12. #ifndef LIBRARIES_SYSMON_H
  13. #define LIBRARIES_SYSMON_H
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. #ifndef EXEC_LIBRARIES_H
  20. #include <exec/libraries.h>
  21. #endif
  22.  
  23. #ifndef DEVICES_TIMER_H
  24. #include <devices/timer.h>
  25. #endif
  26.  
  27. #ifndef DOS_DATETIME_H
  28. #include <dos/datetime.h>
  29. #endif
  30.  
  31. /* Library data structure
  32. ** All field in the SysmonBase structure are PRIVATE !!!
  33. ** Don't access these directly as they will change in future versions.
  34. ** You have been warned !!!
  35. */
  36.  
  37. #define    HASHSIZE    32
  38. #define HASHMASK    0xf8
  39.  
  40. struct SysmonBase
  41. {    struct Library sb_Lib;            /* Standard lib node    */
  42.     UBYTE    sb_Flags;            /* Some flags here    */
  43.     UBYTE    sb_pad;                /* We are now longword aligned    */
  44.     struct ExecBase *sb_ExecBase;        /* Pointer to exec    */
  45.     struct Library *sb_UtilityBase;        /* Pointer to utility    */
  46.     BPTR    sb_SegList;            /* SegList BCPL pointer    */
  47.     struct TaskInfo *sb_CurrTaskInfo;    /* Current TaskInfo Structure    */
  48.     APTR    sb_Switch;            /* Original Switch() entry point    */
  49.     APTR    sb_Dispatch;            /* Original Dispatch() entry point    */
  50.     APTR    sb_AddTask;            /* Original AddTask() entry point    */
  51.     APTR    sb_RemTask;            /* Original RemTask() entry point    */
  52.     APTR    sb_TaskExit;            /* Original ExecBase->TaskExitCode    */
  53.     struct timerequest sb_TimeReq;        /* Time Request    */
  54.     struct EClockVal sb_TempTime;        /* Temporary EClock Time    */
  55.     struct List sb_TaskFrozen;        /* Frozen task list    */
  56.     UWORD    sb_Reserved0;            /* For longword alignment    */
  57.     struct TaskInfo *sb_TaskInfoHash[HASHSIZE]; /* TaskInfo hash table    */
  58.     APTR    sb_FindTask;            /* Original FindTask() entry point */
  59.     APTR    sb_ServerEntry;            /* Server process entry point    */
  60.     STRPTR    sb_ServerName;            /* Server process name    */
  61.     STRPTR    sb_SyslogFile;            /* SysLog file name    */
  62.     STRPTR    sb_SyslogWindow;        /* Syslog Window Name    */
  63.     UBYTE    sb_FilePri;            /* File logging priority    */
  64.     UBYTE    sb_WindowPri;            /* Window logging priority    */
  65.     UBYTE    sb_ConsolePri;            /* Console logging priority    */
  66.     UBYTE    sb_NumLogBuffers;        /* Number of allocated Buffers    */
  67.     struct SysLogMsg *sb_Buffers;        /* Pointer to allocated buffers    */
  68.     struct Library *sb_DOSBase;        /* Pointer to dos    */
  69.     struct DateTime    *sb_DateTime;        /* SysLog DateTime structure */
  70.     ULONG    sb_StampPeriod;            /* Period for syslog file stamp    */
  71.     BPTR    sb_LogWindowHandle;        /* LogWindow file handle    */
  72.     struct Library *sb_IntuitionBase;    /* Pointer to intuition    */
  73.     ULONG    sb_LastGuru;            /* Guru Meditation code after crash */
  74.     struct MsgPort *sb_SyslogPort;        /* Pointer to Syslog MsgPort    */
  75. };
  76.  
  77. /* The TaskInfo structure contains the CPU usage information in EClock ticks.
  78. ** The link pointers are private and should not be used. Use the smNextTaskInfo()
  79. ** function to traverse the list.
  80. ** This structure may be extended later with new fields.
  81. */
  82.  
  83. struct TaskInfo
  84. {    struct TaskInfo *ti_Link;        /* PRIVATE pointer to next TaskInfo */
  85.     struct TaskInfo *ti_Pred;        /* PRIVATE pointer to previous TaskInfo    */
  86.     struct Task *ti_Task;            /* pointer to Task Control Block */
  87.     ULONG    ti_DispCount;            /* Task Dispatch counter */
  88.     struct EClockVal ti_StartTime;        /* Starting EClock Time    */
  89.     struct EClockVal ti_LaunchTime;        /* Last Launch Time */
  90.     struct EClockVal ti_CPUTime;        /* Cumulated CPU Time */
  91. };
  92.  
  93. /* This is the private structure used by smVSysLog() to communicate with the
  94. ** Sysmon.server process.
  95. */
  96.  
  97. #define    SM_MAXLOGCHARS    256            /* Max bytes in SysLog message    */
  98.  
  99. struct    SysLogMsg
  100. {    struct Message    slm_MsgHead;        /* Message header    */
  101.     ULONG    slm_Priority;            /* SysLog priority and flags    */
  102.     UBYTE    slm_Text[SM_MAXLOGCHARS];    /* Syslog Message body    */
  103. };
  104.  
  105. #define    SYSMONNAME    "sysmon.library"
  106. #define    SERVERNAME    "Sysmon.server"
  107.  
  108. /* Definition of sb_Flags bits    */
  109.  
  110. #define SBFB_FPU    0            /* System has a FPU    */
  111. #define    SBFF_FPU    (1L << 0)
  112. #define    SBFB_IDLELED    1            /* Dim power LED when CPU is idle    */
  113. #define    SBFF_IDLELED    (1L << 1)
  114.  
  115. /* Alert Definitions
  116. ** These are the Guru codes that sysmon.library can spit out in a panic
  117. ** condition.
  118. */
  119.  
  120. #define    AN_Sysmon    0x40000000        /* SubSystem ID    */
  121. #define    AN_smNoTaskInfo    0xC0000001        /* No TaskInfo at Dispatch() time    */
  122. #define    AN_smNoTIMem    0x40010002        /* No mem for TaskInfo at startup    */
  123. #define    AN_smSysLogBuf    0x40010003        /* No memory for syslog buffers    */
  124. #define    AN_BadSysLogMsg    0x40000004        /* Bad SysLogMsg received by server */
  125. #define AO_Sysmon    0x00008040        /* Alert object    */
  126.  
  127. /* New Task States Definitions
  128. ** TS_STOP is not a real state. It is used by ShowSys to identify tasks that
  129. ** are stuck in a Wait(0) call, such as crashed tasks that have been suspended.
  130. */
  131.  
  132. #define    TS_FROZENW    0x80            /* Frozen task previously in WAIT state    */
  133. #define    TS_STOP        TS_FROZENW        /* Stopped task (Wait(0L))    */
  134. #define    TS_FROZEN    0x81            /* Frozen task    */
  135.  
  136. /* SysLog Priorities and flags
  137. ** The priorities are similar to that used on UNIX systems. This means that
  138. ** the values use the UNIX ordering that is reversed from the Amiga one.
  139. ** The flags are Amiga and sysmon specifics.
  140. */
  141.  
  142. #define    LOG_EMERG    0            /* Panic condition (Guru time)    */
  143. #define    LOG_ALERT    1            /* Very serious problem    */
  144. #define LOG_CRIT    2            /* Critical error    */
  145. #define    LOG_ERR        3            /* General error condition    */
  146. #define    LOG_WARN    4            /* Warning condition    */
  147. #define    LOG_NOTICE    5            /* Noticeable event    */
  148. #define    LOG_INFO    6            /* General informational event    */
  149. #define    LOG_DEBUG    7            /* Debugging information    */
  150. #define    LOG_PRI        0x07            /* Mask for priority field    */
  151.  
  152. #define    LOG_INUSE    0x80000000        /* Message is in use (private !) */
  153. #define    LOG_NOHEAD    0x40000000        /* Don't prepend header    */
  154. #define    LOG_NOWIN    0x20000000        /* Don't output to window    */
  155. #define    LOG_NOFILE    0x10000000        /* Don't output to file    */
  156.  
  157. #define    LOGB_INUSE    31            /* Bit numbers for flags    */
  158. #define    LOGB_NOHEAD    30
  159. #define    LOGB_NOWIN    29
  160. #define    LOGB_NOFILE    28
  161.  
  162. /* Flags definitions for smHalt()    */
  163.  
  164. #define    HALTB_REBOOT    0        /* Reboot immediately    */
  165. #define    HALTF_REBOOT    (1L << 0)
  166. #define    HALTB_REKICK    1        /* Reload kickstart on MMU-Kicked systems.    */
  167. #define    HALTF_REKICK    (1L << 1)
  168.  
  169. #endif  /* LIBRARIES_SYSMON_H */
  170.